//
//  RTBaseViewController.m
//  WeiboSina
//
//  Created by Brisinga on 16/3/4.
//  Copyright © 2016年 Root. All rights reserved.
//

#import "RTBaseViewController.h"

@interface RTBaseViewController ()<RTVisitorViewDelegate>

@end

@implementation RTBaseViewController


#pragma mark - 重写view加载方法
- (void)loadView {
    
    if (islogin) {
        
        [super loadView];
        
    }else {
        
        [self loadVisitorView];
    }
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    }


#pragma mark - 登录按钮点击事件
- (void)loginBtnDidClick:(UIButton *)sender {
    
    NSLog(@"登录");
    
    
}



#pragma mark - 注册按钮点击事件
- (void)registerBtnDidClick:(UIButton *)sender {
    
    NSLog(@"注册");
}


#pragma mark - RTVisitorViewDelegate
- (void)visitorView:(RTVisitorView *)visitorView didClickLogin:(UIButton *)loginBtn {
    
    [self loginBtnDidClick:loginBtn];
}


- (void)visitorView:(RTVisitorView *)visitorView didClickRegister:(UIButton *)registerBtn {
    
    [self registerBtnDidClick:registerBtn];
}



#pragma mark - 加载visitorView
- (void)loadVisitorView {
    
    self.view = self.visitorView;
    
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem buttonItemWithImageName:nil title:@"注册" addTarget:self action:@selector(registerBtnDidClick:)];
    
    self.navigationItem.rightBarButtonItem = [UIBarButtonItem buttonItemWithImageName:nil title:@"登录" addTarget:self action:@selector(loginBtnDidClick:)];
}




#pragma mark - 懒加载visitorView
- (RTVisitorView *)visitorView {
    
    if (nil==_visitorView) {
        
        _visitorView = [[RTVisitorView alloc] init];
        
        _visitorView.delegate = self;
    }
    
    return _visitorView;
}

@end
